package com.stox.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import lombok.Data;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;


@Data
@Entity
@JsonIgnoreProperties({"children","entries"})
public class Watchlist implements Serializable{
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue( strategy = GenerationType.IDENTITY )
	private Long id;
	
	private String name;
	
	@Column(name="PARENT_ID", nullable=true)
	private Long parentId;
	
	@OneToMany(cascade=CascadeType.ALL, orphanRemoval=true)
	private Set<Watchlist> children;
	
	@ManyToMany(cascade=CascadeType.REFRESH)
	private Set<Scrip> entries;
	
}
